package o;

import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.concurrent.TimeUnit;

public class fxv {
    public static final fxv ॱ = new fxv() {
        public fxv ˊ(long j, TimeUnit timeUnit) {
            return this;
        }

        public fxv ˋ(long j) {
            return this;
        }

        public void ʼ() throws IOException {
        }
    };
    private long ˊ;
    private boolean ˋ;
    private long ˏ;

    public fxv ˊ(long j, TimeUnit timeUnit) {
        if (j < 0) {
            throw new IllegalArgumentException("timeout < 0: " + j);
        } else if (timeUnit == null) {
            throw new IllegalArgumentException("unit == null");
        } else {
            this.ˏ = timeUnit.toNanos(j);
            return this;
        }
    }

    public long as_() {
        return this.ˏ;
    }

    public boolean at_() {
        return this.ˋ;
    }

    public long ˏ() {
        if (this.ˋ) {
            return this.ˊ;
        }
        throw new IllegalStateException("No deadline");
    }

    public fxv ˋ(long j) {
        this.ˋ = true;
        this.ˊ = j;
        return this;
    }

    public fxv ˊ() {
        this.ˏ = 0;
        return this;
    }

    public fxv ॱॱ() {
        this.ˋ = false;
        return this;
    }

    public void ʼ() throws IOException {
        if (Thread.interrupted()) {
            throw new InterruptedIOException("thread interrupted");
        } else if (this.ˋ && this.ˊ - System.nanoTime() <= 0) {
            throw new InterruptedIOException("deadline reached");
        }
    }
}
